﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using YWTSSys.BLL;
using YWTSSys.Library;
using YWTSSys.Model;
using System.Text;

namespace YWTSSys.Web.MachineSys.YWTSWeb.gl
{
    public partial class CustomerGroupAddGroupArea : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.新增};
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "CustomerGroupMasterListaspx";
            }
        }

        protected string AreaName
        {
            get
            {
                return GetRequestValue<string>("AreaName", "");

            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "add")
            {
                addmenu();
            }
        }
        private void addmenu()
        {
            CustomerGroupInfo obj = Request.SerializableObject<CustomerGroupInfo>();
            obj.UserId = GetRequestValue<int>("dwz.orgLookup.UserId", 0);
            obj.上级分组 = AreaName;
            // obj.UserName = GetRequestValue<string>("dwz_orgLookup.UserName", "");
            bool r = CustomerGroupController.AddGroup(obj);

            AddLog(Permission.新增, obj);

            if (r)
                SuccessJson("分配成功", this.DWZRef);
            else
            {

                ErrorJson("分配失败", this.DWZRef);
            }
        }
    }
}